/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cashmate.utilities;

import java.io.Serializable;

/**
 *
 * @author dean
 */
public class PerformanceObject implements Serializable {

    private String areacode;
    private double firstcut;
    private double secondcut;
    private double thirdcut;
    private double fourthcut;
    private double fifthcut;
    private double totalperarea;
    private int count;
    private double totalrate;

    public PerformanceObject() {
    }

    public PerformanceObject(String areacode, double firstcut, double secondcut, double thirdcut, double fourthcut, double fifthcut, double totalperarea, String type, String dategenerated) {
        this.areacode = areacode;
        this.firstcut = firstcut;
        this.secondcut = secondcut;
        this.thirdcut = thirdcut;
        this.fourthcut = fourthcut;
        this.fifthcut = fifthcut;
        this.totalperarea = totalperarea;
    }

    public String getAreacode() {
        return areacode;
    }

    public void setAreacode(String areacode) {
        this.areacode = areacode;
    }

    public double getFifthcut() {
        return fifthcut;
    }

    public void setFifthcut(double fifthcut) {
        if (areacode.equals("Overall")) {
            count = 5;
        }
        this.fifthcut = fifthcut;
    }

    public double getFirstcut() {
        return firstcut;
    }

    public void setFirstcut(double firstcut) {
        if (areacode.equals("Overall")) {
            count = 1;
        }
        this.firstcut = firstcut;

    }

    public double getFourthcut() {
        return fourthcut;
    }

    public void setFourthcut(double fourthcut) {
        if (areacode.equals("Overall")) {
            count = 4;
        }
        this.fourthcut = fourthcut;
    }

    public double getSecondcut() {
        return secondcut;
    }

    public void setSecondcut(double secondcut) {
        if (areacode.equals("Overall")) {
            count = 2;
        }
        this.secondcut = secondcut;
    }

    public double getThirdcut() {
        return thirdcut;
    }

    public void setThirdcut(double thirdcut) {
        if (areacode.equals("Overall")) {
            count = 3;
        }
        this.thirdcut = thirdcut;
    }

    public double getTotalperarea() {
        if (areacode.equals("Overall")) {
            totalperarea = Utils.roundToDecimals((firstcut + secondcut + thirdcut + fourthcut + fifthcut) / count, 2);
        } else {
            totalperarea = Utils.roundToDecimals(firstcut + secondcut + thirdcut + fourthcut + fifthcut, 2);
        }
        return totalperarea;
    }

    public double getTotalrate() {
        System.out.println(firstcut+" "+secondcut+" "+thirdcut+" "+fourthcut+" "+fifthcut);
        totalrate = Utils.roundToDecimals((firstcut + secondcut + thirdcut + fourthcut + fifthcut) / 5, 2);
        return totalrate;
    }

    public void setTotalrate(double totalrate) {
        this.totalrate = totalrate;
    }
    
    public void setTotalperarea(double totalperarea) {
        this.totalperarea = totalperarea;
    }
}
